import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useUploadingStore = defineStore('uploading', () => {
  const fileList = ref([])
  const dialogUploadingVisible=ref(false)

  function add(...payload) {
    // debugger
    fileList.value.push(...payload)
    
  }
  function del(i) {
    fileList.value.splice(i,1)
    
    
  }
  function update(i,key,value) {
    fileList.value[i][key]=value
    
  }
  function reset() {
    fileList.value=[]
    
  } 
  
  function updateDialogUploadingVisible(payload) {
    dialogUploadingVisible.value=payload
    
  }

  return { fileList, add,del,update,reset ,dialogUploadingVisible,updateDialogUploadingVisible}
})